@extends('admin.layout')
@section('content')
            
      <!-- BEGIN MAIN CONTENT -->
      
      
      <section id="main-content">
             
    <!-- BEGIN WRAPPER  -->
        <section class="wrapper">
                     <section class="panel">
                        <header class="panel-heading">
                           <a href="javascript:;" class="fa fa-chevron-down"></a>
                           <a href="javascript:;" class="fa fa-times"></a>
                           </span>
                        </header>

                           
                         @if (count($errors) > 0)
                           <div class="box-body">
                              <div class="alert alert-danger alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <h4><i class="fa fa-warning"></i> 商品添加失败:</h4>
                        
                            
                                <ul>
                                    @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                             </div>
                            </div><!-- /.box-body -->
                        @endif  

                        @if(session('info')) 

                            <div class="box-body">
                              <div class="alert alert-danger alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <h4><i class="fa fa-warning"></i> {{ session['info'] }}!</h4>
                        @endif          

                        <div class="panel-body" >
                        <label for="InputUsername">该商品属于{{ $cate_name }}分类:</label>
                           <form  action="/admin/goods/insert" method="post" enctype="multipart/form-data">
                            {{ csrf_field() }}
                              <div class="form-group">
                              <input type="hidden" value="{{ $data -> id }}" name="cid">

                                 <label for="InputUsername">商品名称</label>
                                 <input class="form-control" id="InputName" placeholder="请输入商品名称" type="text" name="good_name"　value="">

                                 <label for="InputUsername">商品价格</label>
                                 <input class="form-control" id="InputPrice" placeholder="请输入商品价格" type="text" name="good_price"　value="">

                                 <label for="InputUsername">商品库存</label>
                                 <input class="form-control" id="InputStore" placeholder="请输入商品库存" type="number" name="good_store"　value="">

                                 <label for="InputUsername">商品状态</label>
                                    <select class="form-control" name='good_status'>
                                        <option value="0">即将发售</option>
                                        <option value="1">正在出售</option>
                                        <option value="2">正在热销</option>
                                        <option value="3">清理库存</option>
                                        <option value="4">已经下架</option>
                                        <option value="5">正在预售</option>
                                    </select>
                                

                                 <label for="InputUsername">商品展示图片</label>
                                 <input id="InputImg" type="file" name="good_img">
                                 <br>
                                 <table>
                                   @foreach($attrs_arr as $k => $v)
                                   @if($i % 3 ==0)
                                    <tr height='40px'>
                                   @endif
                                      <td>
                                        {{ $v }}:
                                      </td>
                                      <td>
                                        <input class="minimal" type="text" name="{{ $k }}" checked="checked" value=" "> <br>
                                      </td>

                                    <input type="hidden" {{ $i++ }}>
                                   @endforeach
                                 </table>
                                 

                                <!-- 加载编辑器的容器 -->
                                <script id="container" name="good_detail" type="text/plain"></script>
                                <!-- 配置文件 -->
                                <script type="text/javascript" src="{{ url('Ueditor/ueditor.config.js') }}"></script>
                                <!-- 编辑器源码文件 -->
                                <script type="text/javascript" src="{{ url('Ueditor/ueditor.all.js') }}"></script>
                                <!-- 实例化编辑器 -->
                                <script type="text/javascript">
                                    var ue = UE.getEditor('container');
                                </script>


                              </div>  
                              

                                

                              <button type="submit" class="btn btn-info">添加新的商品</button>
                           </form>
                        </div>
                     </section>
               </section>
    <!-- END WRAPPER  -->
      </section>
      <!-- END MAIN CONTENT -->
           

@endsection